Release 10.1A: OpenEdge Data Management:
SQL Reference
Unsubscripted array updates and inserts
OpenEdge SQL applies the reverse of the fetch algorithm for updates to unsubscripted Progress 4GL array columns. An SQL operation accepts an
NVARCHARstring, complete with separators and any required escape characters. OpenEdge SQL converts the string to the underlying data type and stores it in the current element of the array in the OpenEdge database. SQL repeats this operation for each element of the array until all elements have been inserted.This is the SQL syntax for an unsubscripted array update:
Example
The
ARRAYINTexample assumes an integer array namedARRAYINT. The result of theUPDATEoperation is:ARRAYINT[ 1 ] = 13ARRAYINT[ 2 ] = 15ARRAYINT[ 3 ] = 19
If the number of elements in the
NVARCHARstring does not match the number of elements in the target column for the update, OpenEdge SQL returns an error, unless there is exactly one element in theNVARCHARstring for anINSERToperation.If there is a single element in the
NVARCHARstring, you can use the OpenEdge SQLINSERTstatement to propagate the value to all elements of the array.This is the SQL syntax for this short form of an
INSERTassignment:
Example
The following
INSERTexample illustrates how you can assign values to an entire date array from a single value in theVALUESclause of an SQLINSERTstatement:
This
Note: OpenEdge SQL does not support the assignment of a single value to an entire array using an SQLINSERTexample assigns the value '01/01/03' to every element of the date array 'begin_quota_date' column in the customer table.UPDATEstatement.Updating a single element of an array
To update a single element of an array, you must construct a string for the entire array, and assign the string to the array using an SQL
UPDATEstatement.This is the SQL syntax for updating a single element of an array:
Examples
To assign a value to the first element of an array of size three, construct a literal string that concatenates these components:
Use
PRO_ARR_ESCAPEto insert any necessary escape characters into the new value. UsePRO_ELEMENTto extract the values for elements two and three from the array. This example assigns the value 'aaa' to the first element of the arraychar array for customer 99, and retains the existing values for elements two and three:
To assign a value to the second element of an array of size three, construct a string that concatenates these components:
Use
PRO_ARR_ESCAPEto insert any necessary escape characters into the new value. UsePRO_ELEMENTto extract the first and third elements from the array. This example assigns the value 'bbb' to the second element of thearraychararray for customer 99, and retains the existing values for elements one and three inarraychar:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |